<template>
  <div>
    <el-table
      v-if="!loading"
      :data="recordsData"
      :show-header="false"
    >
      <el-table-column>
        <template slot-scope="scope">
          <!-- <pre>{{scope.row}}</pre> -->
          <div style="margin-bottom:6px">{{scope.row.title}}</div>
          <div>
            <el-tag
              size="mini"
              :type="scope.row.pass=='是'?'success':'danger'"
              style="margin-right:6px"
            >{{scope.row.pass=='是'?'通过':'不通过'}}</el-tag>
            <el-tag
              size="mini"
              type="info"
              style="margin-right:6px"
            >{{scope.row.traineeName}}</el-tag>
            <!-- <el-tag
                size="mini"
                type="info"
                style="margin-right:6px"
              >{{scope.row.year}}年度</el-tag> -->
            <el-tag
              size="mini"
              type="info"
              style="margin-right:6px"
            >{{dateFormat("M月d日",new Date(scope.row.trainingDate))}}</el-tag>
            <el-tag
              v-if="scope.row.traineeComments.length==0"
              size="mini"
              type="warning"
              style="margin-right:6px"
            >学员未填</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        width="60px"
        align="right"
      >
        <template slot-scope="scope">
          <el-button
            type="primary"
            icon="el-icon-edit"
            plain
            circle
            @click="$emit('modify',scope.$index)"
          ></el-button>
          <!-- <el-button
            type="danger"
            icon="el-icon-delete"
            plain
            circle
            @click="$emit('modify',scope.$index)"
          ></el-button> -->
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  import { format } from "@/utils/datetime.js";
  export default {
    name: "recordTable",
    props: { loading: { type: Boolean, required: true } },
    data() {
      return {
        //
      }
    },
    computed: {
      recordsData() { return this.$store.state.coachRecords },
    },
    methods: {
      dateFormat: format,
    },
  }
</script>